package Frame.librarianFrame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Frame.common.BackgroundFrame;
import controller.Controller;

public class LbBackgroundFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private JPanel panel1;
	private JPanel contentPane;
	private Controller controller;
	private JLabel label9;
	/**
	 * 登录图书管理员的界面 即初始界面 
	 */
	public LbBackgroundFrame(Controller controller) { 
		//controller = new Controller();    //注意 这里实例化了controller类
		this.controller = controller;
		controller.setLbBackgroundFrame(this);
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕大小
		this.setTitle("图书管理系统");
		this.setBounds(0,0,screenSize.width, screenSize.height);
		this.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);//这个就是设置窗口最大化
		//this.setResizable(false);// 禁用最大化按钮
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		URL librarian = getClass().getResource("/logo/白猫.jpg"); 
		contentPane = new BackgroundFrame(librarian); 
		//contentPane.setBounds(0, 0, 1920, 1080);
		contentPane.setLayout(null); 
		contentPane.add(panel1()); 
		contentPane.setOpaque(false);
		setContentPane(contentPane);	 
		this.setVisible(true); 
	} 
	public JPanel panel1() {
		panel1 = new JPanel(); 
		panel1.setLocation(0, 0);
		panel1.setSize(1920, 86);
		panel1.setLayout(null); 

		JLabel label1 = new JLabel("个人信息");
		label1.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/个人信息.png")));
		label1.setBackground(SystemColor.activeCaption);
		label1.addMouseListener(controller);
		label1.setName("personalImformation");
		panel1.add(label1);
		label1.setFont(new Font("华文楷体", Font.BOLD, 20));
		label1.setBounds(200, 10, 160, 66);

		JLabel label2 = new JLabel("图书管理");
		label2.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/图书管理.png")));
		label2.setFont(new Font("华文楷体", Font.BOLD, 20));
		label2.setBackground(SystemColor.activeCaption);
		label2.addMouseListener(controller);
		label2.setName("bookImformation");
		label2.setBounds(15, 10, 160, 66);
		panel1.add(label2);

		JLabel label3 = new JLabel("图书借还");
		label3.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/图书借阅 .png")));
		label3.setFont(new Font("华文楷体", Font.BOLD, 20));
		label3.setBackground(SystemColor.activeCaption);
		label3.addMouseListener(controller);
		label3.setName("bookBorrow");
		label3.setBounds(385, 10, 160, 66);
		panel1.add(label3);

		JLabel label6 = new JLabel("借阅查询 & 续借");
		label6.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/借阅查询.png")));
		label6.setFont(new Font("华文楷体", Font.BOLD, 20));
		label6.setBackground(SystemColor.activeCaption);
		label6.setBounds(570, 10, 228, 66);
		label6.addMouseListener(controller);
		label6.setName("borrowQuery");
		panel1.add(label6); 
		
		JLabel label7 = new JLabel("欢迎您！");
		label7.setForeground(new Color(244, 164, 96));
		label7.setFont(new Font("华文行楷", Font.BOLD, 25));
		label7.setBounds(1474, 32, 104, 25);
		panel1.add(label7);
		
		JLabel label8 = new JLabel("图书管理员：");
		label8.setForeground(new Color(244, 164, 96));
		label8.setFont(new Font("华文行楷", Font.BOLD, 25));
		label8.setBounds(1577, 32, 160, 25);
		panel1.add(label8);
		
		label9 = new JLabel();
		label9.setForeground(new Color(244, 164, 96));
		label9.setFont(new Font("华文行楷", Font.BOLD, 26));
		label9.setBounds(1734, 32, 186, 25);
		panel1.add(label9);
		
		JLabel label10 = new JLabel("欢迎您！");
		label10.setText(new SimpleDateFormat("yyyy 年 MM 月 dd 日  EEEE").format(new Date()));	//设置每日更新的日期label
		label10.setForeground(new Color(0, 0, 0));
		label10.setFont(new Font("华文楷体", Font.BOLD, 21));
		label10.setBounds(1049, 31, 288, 25);
		panel1.add(label10);
		panel1.setOpaque(false);
//		contentPane.add(panel1);
		return panel1;
	}
	public Controller getController() {
		return controller;
	}
	public void setController(Controller controller) {
		this.controller = controller;
	}
	public JLabel getLabel9() {
		return label9;
	}
	public void setLabel9(JLabel label9) {
		this.label9 = label9;
	}	
}
